﻿    function Check(e)
    {
	e.checked = true;
    }

    function Clear(e)
    {
	e.checked = false;
    }

    function CheckAll()
    {
	var ml = document.vendorList;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "Mid") {
		Check(e);
	    }
	}
	ml.toggleAll.checked = true;
    }

    function ClearAll()
    {
	var ml = document.vendorList;
	var len = ml.elements.length;
	for (var i = 0; i < len; i++) {
	    var e = ml.elements[i];
	    if (e.name == "Mid") {
		Clear(e);
	    }
	}
	ml.toggleAll.checked = false;
    }
	
	function ToggleAll(e)
    {
	if (e.checked) {
	    CheckAll();
	}
	else {
	    ClearAll();
	}
    }	
    
    //控制右键弹出菜单
    function document_oncontextmenu(divobj,gvobj)
    {       
        showDiv(divobj,gvobj);
        return false;
    }
    var color;
    var index;
    function showDiv(divobj,gvobj)
    {        
        changeRowColor(gvobj);
        
        color = event.srcElement.parentElement.style.backgroundColor.toString();
        index = event.srcElement.parentElement.sourceIndex.toString();
        //alert(event.srcElement.parentElement.sourceIndex.toString());
        //alert(color);
        
        var div = document.getElementById(divobj);
        div.style.display = "block";
        div.style.top = event.clientY;
        div.style.left = event.clientX;
        
        event.srcElement.parentElement.style.backgroundColor = "#D8D5E4";
    }
    function hiddenDiv(divobj,gvobj)
    {
        changeRowColor(gvobj);    
        document.getElementById(divobj).style.display = "none";
    }
    //GridView行变颜色
    function changeRowColor(gvobj)
    {        
        if(color!="" && index!="")
        {            
            var allRows = document.getElementById(gvobj).getElementsByTagName("tr");
            for(var i=0;i<allRows.length;i++)
            {
                if(allRows[i].sourceIndex.toString() == index)
                {
                    allRows[i].style.backgroundColor = color;
                }
            }       
        }        
    }  
    
    //用户自定义Gridview列
    //fid:页面ID,如15251
    //gid:GridviewID,如gvInOutStockRpt
    function gvUserSetting(fid,gid)
    {
        window.location.href = "../Administration/CustomizedPage.aspx?FID="+fid+"&GID="+gid;
    }
    //显示用户自定义Gridview图标的提示信息
    function showGVUserSettingAlt(obj)
    {
        try
        {
             var lang = "zh";
             if(self.parent.frames["banner"] != null && self.parent.frames["banner"] != "undefined")
             {
                  lang = self.parent.frames["banner"].document.getElementById("hdnPerfLanguage").value;
             }
              if(lang == "zh")
              {
                obj.alt = "自定义列表";
              }
              else
              {
                obj.alt = "customize list";
              }     
          }   
          catch(e)
          {
            obj.alt = "自定义列表";
          }
    }
    
    function setTab(name,cursel,n){
 		for(i=1;i<=n;i++){
 		
  		var text=document.getElementById(name+i);
  		var con=document.getElementById("con_"+name+"_"+i);
  		
  		var mainDiv = document.getElementById("divM"+i);
  		var divL = document.getElementById("divL"+i);
 		var divR = document.getElementById("divR"+i);
 		
  		mainDiv.className=i==cursel?"tabLabelCont tabCur": "tabLabelCont tabCur_1";
  		divL.className=i==cursel?"tabL": "tabL_1";
  		divR.className=i==cursel?"tabR": "tabR_1";
  		text.className=i==cursel?"hover":"navigationlabel";
  		con.style.display=i==cursel?"block":"none";
 }
}
	
//	function setTab(name,cursel,n){
//	   	for(i=1;i<=n;i++){
//  		var menu=document.getElementById(name+i);
//  		var con=document.getElementById("con_"+name+"_"+i);
//  		var div = document.getElementById("div"+i);
//  		var imgL = document.getElementById("imgL"+i);
// 		var imgR = document.getElementById("imgR"+i);
//  		div.className =i == cursel?"tabLabelCont tabCur": "tabLabelCont tabCur_1";
//  		imgL.className = i ==cursel?"tabL": "tabL_1";
//  		imgR.className = i ==cursel?"tabR": "tabR_1";
//  		menu.className=i==cursel?"navigationlabel hover":"navigationlabel";
//  		con.style.display=i==cursel?"block":"none";
// }
//}

    //弹出模态窗口
    //path:页面路径
    //pageattr:页面属性，长宽高之类的  
    function popModalWindow(path,pageattr)
    {
        var lang = self.parent.document.getElementById("hdnPerfLanguage").value;
        var style = self.parent.document.getElementById("henPerfStyle").value;
        path = path + "&langstyle=" + lang + "," + style; //ace 2010-8-12 传递语言和样式参数
        //火狐浏览器不支持 window.showModalDialog() 方法 需要做一些特殊处理,以后加上...  jerry 2009-08-08
        var rtnValue = window.showModalDialog(path,lang+','+style,pageattr);
        return rtnValue;
    }

    //弹出模态窗口(快速下单使用)
    //path:页面路径
    //pageattr:页面属性，长宽高之类的
    function FastPopModalWindow(path, pageattr) {
        var lang = self.parent.document.getElementById("hdnPerfLanguage").value;
        var style = self.parent.document.getElementById("henPerfStyle").value;
        path = path + "&action=" + lang + ',' + style + "&ckb=1";
        //火狐浏览器不支持 window.showModalDialog() 方法 需要做一些特殊处理,以后加上...  jerry 2009-08-08
        var rtnValue = window.showModalDialog(path, lang + ',' + style, pageattr);
        return rtnValue;
    }
    //弹出框公用函数
    //path 路径
    //obj 文本框ID
    function QueryGID(path,obj,width,height)
    {
        path = path + "?actionid="+ obj;
        var rtn = window.open (path, "newwindow", "width="+width+",height="+height+", toolbar =no, menubar=yes, scrollbars=yes, resizable=no, location=no,top=100,left=300, status=no") ;
        
    }
    
    //弹出框公用函数
    //path 路径
    //obj 文本框ID
    function QueryByGID(path,obj)
    {
//        path = path + "?actionid="+ obj;
//        var rtn = window.open (path, "newwindow", "width=900,height=700, toolbar =no, menubar=yes, scrollbars=yes, resizable=no, location=no,top=100,left=300, status=no") ;
        
    }
    
    
    //弹出框公用函数
    //path 路径
    //type 类型
    //obj 文本框ID
    function QueryRegionGID(path,obj,type,width,height)
    {
        path = path + "?actionid="+ obj+"&regionType="+type;
        var rtn = window.open (path, "newwindow", "width="+width+",height="+height+", toolbar =no, menubar=yes, scrollbars=yes, resizable=no, location=no,top=100,left=300, status=no") ;
        
    }
    
    
    /* 获取URL中的参数
     *使用方法:
     *    url:http://localhost/test.htm?name=jerry&id=123
     *    取得参数
     *    var temp = getRequest('name');
     */
    function getRequest(obj)
    {
        var url = document.URL;
        var index = url.indexOf("?");
        if(index != -1)
        {
            var str = url.substr(index+1,url.length - index);
            var requests = str.split("&");
            
            for(var i=0;i<requests.length;i++)
            {
                var temp = requests[i].substr(0,requests[i].indexOf("="));
                if(temp == obj)
                {
                    return requests[i].substr(requests[i].indexOf("=")+1,requests[i].length-requests[i].indexOf("="));
                }
            }
        }        
    }
    
    //根据浏览器窗口的大小自动改变查询页面QueryDiv的大小,使底部的按钮始终可见
    //配合 window.onresize 事件使用
    //jerry  2009-09-22
    function autoResizeQueryDiv(obj)
    {
        if(document.getElementById(obj).offsetHeight > document.documentElement.clientHeight - 100)
        {
            document.getElementById(obj).style.height = document.documentElement.clientHeight - 100;
        }
        else
        {
            document.getElementById(obj).style.height = "";
        } 
    }
    
    //对URL中的参数进行重新编码
    function encodeUrlPara(obj,url)
      {
        var gid = encodeURIComponent(obj.id);
        window.location.href = url+gid;
    }
    //保留小数
    //pos：保留的小数位数
    function formatFloat(src, pos) {
        return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);
    }
    //得到表单元素的页面位置
    function getElementPos(elementId) 
    {
 var ua = navigator.userAgent.toLowerCase();
 var isOpera = (ua.indexOf('opera') != -1);
 var isIE = (ua.indexOf('msie') != -1 && !isOpera); // not opera spoof
 var el = document.getElementById(elementId);
 if(el.parentNode === null || el.style.display == 'none') {
  return false;
 }      
 var parent = null;
 var pos = [];     
 var box;     
 if(el.getBoundingClientRect)    //IE
 {         
  box = el.getBoundingClientRect();
  var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
  var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
  return {x:box.left + scrollLeft, y:box.top + scrollTop};
 }else if(document.getBoxObjectFor)    // gecko    
 {
  box = document.getBoxObjectFor(el); 
  var borderLeft = (el.style.borderLeftWidth)?parseInt(el.style.borderLeftWidth):0; 
  var borderTop = (el.style.borderTopWidth)?parseInt(el.style.borderTopWidth):0; 
  pos = [box.x - borderLeft, box.y - borderTop];
 } else    // safari & opera    
 {
  pos = [el.offsetLeft, el.offsetTop];  
  parent = el.offsetParent;     
  if (parent != el) { 
   while (parent) {  
    pos[0] += parent.offsetLeft; 
    pos[1] += parent.offsetTop; 
    parent = parent.offsetParent;
   }  
  }   
  if (ua.indexOf('opera') != -1 || ( ua.indexOf('safari') != -1 && el.style.position == 'absolute' )) { 
   pos[0] -= document.body.offsetLeft;
   pos[1] -= document.body.offsetTop;         
  }    
 }              
 if (el.parentNode) { 
    parent = el.parentNode;
   } else {
    parent = null;
   }
 while (parent && parent.tagName != 'BODY' && parent.tagName != 'HTML') { // account for any scrolled ancestors
  pos[0] -= parent.scrollLeft;
  pos[1] -= parent.scrollTop;
  if (parent.parentNode) {
   parent = parent.parentNode;
  } else {
   parent = null;
  }
 }
 return {x:pos[0], y:pos[1]};
}

/*
 *改变Gridview行背景色
 */
 
 var grivViewColor;//原始样式
 
 //鼠标移除行
 function GridViewRowMouseout(obj) 
 {      
      if(grivViewColor != undefined)
      {
         obj.className = grivViewColor;
      }
 }
 
 //鼠标移上时改变样式
function GridViewRowMouseover(obj) 
{    
    grivViewColor = obj.className;
    obj.className = "GridViewRowMouseMoveStyle";
}

//选中行改变样式
function GridViewCheckBoxClick(obj)
{
  if(document.getElementById(obj).title  == "" )
  {        
       document.getElementById(obj).title = grivViewColor;
       grivViewColor = "GridViewRowSelectStyle";
      document.getElementById(obj).className ="GridViewRowSelectStyle";
  }
  else
  {
    document.getElementById(obj).className =document.getElementById(obj).title;
    grivViewColor = document.getElementById(obj).title;
    document.getElementById(obj).title = "";
  }
}
//全选
function GridViewAllCheckBoxClick(obj,state)
{
  if(obj != "")
  {        
        if(state)
        {
         if(document.getElementById(obj).title == "")
           {
               document.getElementById(obj).title = document.getElementById(obj).className;         
               document.getElementById(obj).className ="GridViewRowSelectStyle";
          }
         }
         else
         {
           if(document.getElementById(obj).title != "")
           {
                document.getElementById(obj).className =document.getElementById(obj).title;       
                document.getElementById(obj).title = "";
            }
          }
  }
}



/*
*仓库加载JS
*
*CreateBy:   Black
*
*CreateDate: 2009-06-30
*
*需要的引用有
* <script src="Js/jquery.js" type="text/javascript"></script>   
* <script src="Js/jquery.simplemodal.js" type="text/javascript"></script>
/*--------------------------------------------------------------------------*/
         var xmlhttp;

   document.write("<div style='display:none; width:100%' id=\"WindowDiv\" name=\"WindowDiv\" value =5></div>");
      //显示DIV
      function DivWindow() 
        {
          try
          {
              if(document.getElementsByName('WindowDiv') !=null)
               {
                WhHtml();         
                $(document.getElementsByName('WindowDiv')).modal();
               }
          }
         catch(e)
         {
           alert("当前页面暂时不支持仓库切换,请到其他页面重新切换！");
         }
        }
        //隐藏 DIV
        function DivClose()
        {
          $.modal.close();
        }
        function DivCloseAll()
        {
            self.parent.frames["banner"].DivClose()
            DivClose();
            self.parent.frames['banner'].hideshow();
            self.parent.frames["border"].document.getElementById('hdnClass').vaule=0;
            self.parent.frames["border"].document.getElementById('flag').className = "switch";
             
        }
        function MenuMouseout(Name) 
        {
           document.getElementById(Name + '_Div').className='warehouspic';
        }
        function MenuMousemove(Name) 
        { 
          document.getElementById(Name + '_Div').className = 'warehouspicon';   
        }
        function WhHtml()
        {
             NameAuthentication();
        }
   
                //创建浏览器对象
             function createXMLHttpRequest() 
             {                 
                if (window.XMLHttpRequest) 
                { 
                    xmlhttp = new XMLHttpRequest(); 
                    if (xmlhttp.overrideMimeType) 
                    { 
                        xmlhttp.overrideMimeType("text/xml"); 
                    } 
                } 
                else if (window.ActiveXObject) 
                { 
                    var activexName = ["MSXML2.XMLHTTP","Microsoft.XMLHTTP"]; 
                    for (var i = 0; i < activexName.length; i++) 
                    { 
                        try
                        { 
                            xmlhttp = new ActiveXObject(activexName[i]); 
                            break; 
                        } 
                        catch(e)
                        { 
                        } 
                    } 
                } 
              }

                //异步请求
                function NameAuthentication()
                {                
                  var Url;
                 var href = location.href.split('/');
                 if(href[href.length-1].replace("#","") == "default.htm" ) //black 2009-9-24修改  剔除#号
                 {
                   Url = "Common/GetWHAjax.aspx?TYPE=GETWH&ram="+Math.round(Math.random()*100);
                 }
                 else
                 {                   
                   Url = "../Common/GetWHAjax.aspx?TYPE=GETWH&ram="+Math.round(Math.random()*100);
                 }
                    createXMLHttpRequest();                    
                    xmlhttp.onreadystatechange = handleStateChange;
                    xmlhttp.open("GET", Url, true);
                    xmlhttp.send(null);
                }
                //返回数据
                function handleStateChange()
                 {
                    if (xmlhttp.readyState == 4) 
                    {
                        if (xmlhttp.status == 200)
                         {                                               
                            if (xmlhttp.responseText == "SessionLose") 
                            {
                             
                             top.location.href='Login.aspx';
                            }
                            else 
                            {                             
                                document.getElementById("WindowDiv").innerHTML = xmlhttp.responseText;
                                setTimeout("CloseOut()",15000);
                                
                            }
                        }
                    }
                 }
                        //根据选择的仓库重新加载数据
                function Updateload(WhName,IsGloabl,WhDbDesc)
                {
                 try
                   {                
                 
                     self.parent.frames["contents"].UpdateLoad(WhName,IsGloabl,WhDbDesc);    
                   }     
                  catch(e)
                  {
                   
                  }        
                }
                
                //当切换仓库 超时后 自动关闭 遮盖层
                function CloseOut()
                {
                 
                 if(document.getElementById("WindowDiv").style.display!='none')
                 {
                     self.parent.frames["banner"].DivClose()
                     self.parent.frames["main"].DivClose();              
                     self.parent.frames['banner'].hideshow();
                   
                 }              
                }
                
                
                
                  //异步请求
                function ImporDataAuthentication(action,OrderID,OwnerID,customerID)
                {                
                  var Url = "../Common/ImporDataAjax.aspx?action="+escape(action)+"&OrderID="+escape(OrderID)+"&OwnerID="+escape(OwnerID)+"&customerID="+escape(customerID)+"&ram="+Math.round(Math.random()*100);
                    createXMLHttpRequest();                    
                    xmlhttp.onreadystatechange = ImporDataStateChange;
                    xmlhttp.open("GET", Url, true);
                    xmlhttp.send(null);
                    $('#WindowDiv').modal();
                }
                
                  //返回数据
                function ImporDataStateChange()
                 {
                    if (xmlhttp.readyState == 4) 
                    {
                        if (xmlhttp.status == 200)
                         {                                               
                            if (xmlhttp.responseText == "SessionLose") 
                            {
                             
                             top.location.href='Login.aspx';
                            }
                            else 
                            {                             
                                document.getElementById("WindowDiv").innerHTML = xmlhttp.responseText;
                            }
                        }
                    }
                 }

//     ///控件失去焦点后
//     //对比页面控件的值是否和原来相同
     function RecordPageValue(txt,obj,hdnName)
     {
        var values = obj.value;
        if(txt != values)
        {
        
             var dd=obj.RecordValue;
             if(obj.RecordValue !=1)
             {
                var quantity = document.getElementById(hdnName).value;
                document.getElementById(hdnName).value = parseInt(quantity)+1;
                obj.RecordValue = 1;
             }
        }
        else
        { 
           if(obj.RecordValue >0)
           {
            var quantity =document.getElementById(hdnName).value
            document.getElementById(hdnName).value = parseInt(quantity)-1;
            obj.RecordValue = 0;
           }
        }
     }
     //保存页面信息    obj 保存按钮的ID ，hdnname 隐含域的name
     function SavePageValue(obj,hdnName)
     {
      //每个页面都会添加 的标识符号！ 在页面出发TextChanged 事件前吧 值改为1  调用完毕后页面刷新 吧值修改成 (修改 是在 页面 TextChanged 事件内修改 )0 ； 防止事件刷新页面带来的错误判断
         if( document.getElementById("hdnPageType").value == "1" ) 
         {             
              return;
         }
         var quantity = document.getElementById(hdnName).value;       
       
        if(quantity>0)//当值大于0 的时候代表页面的数据已经被修改过了！
        {     
            if(!(window.event.clientX>document.body.clientWidth)&& !(window.event.clientY<0 || window.event.altKey))
               {
                   var lang = self.parent.frames["banner"].document.getElementById("hdnPerfLanguage").value;
                   if(lang != "")
                   {
                       if(lang == "zh")
                       {
                           if(confirm("页面内容已经被修改,是否保存?"))
                           {             
                             __doPostBack('btnSave','');                    
                           }
                       }
                       else
                       {
                           if(confirm("Page content had been changed,Save it?"))
                           {             
                             __doPostBack('btnSave','');  
                           }
                       }
                   }
               }
        }
     }
     //还原 隐含于的值
     function  SethdnPageQty(hdnName)
     {
        document.getElementById(hdnName).value="0"; 
     }
     
         //还原 隐含于的值
     function  SethdnPageQty1(hdnName)
     {
        document.getElementById(hdnName).value="1"; 
     }
     
      //显示另一个日期条件
    function showAnotherDate(self,obj1)
    {
        if(self == "Between")
        {
            obj1.style.display = "block";
        }
        else
        {
            obj1.style.display = "none";
        }	        
    }
    
    //获取 遮盖层的 提示信息
    function GetBlockUIMsg()
    {
        var blockUIMsg = "<img src='../Images/loading.gif' /> &nbsp;&nbsp;&nbsp;Please wait a monent...";
        var lang = self.parent.document.getElementById("hdnPerfLanguage").value;
        if(lang == "zh")
        {
            blockUIMsg = "<img src='../Images/loading.gif' /> &nbsp;&nbsp;&nbsp;请稍候...";
        }
        return blockUIMsg;
    }
    //获取 遮盖层的 背景色
    function GetBlockUIBgColor()
    {
        var bgColor = "#FAFAFA";
        return bgColor;
    }
    document.write("<div class=\"div_list\" id=\"more1\" style=\"height:auto; width:153px; position:absolute;display:none;border:none 0 black\" onclick=\"CloseSearch();\" ></div>"); 
    /******************************************************************************************************************/
    //异步请求
    var oldValue = "";
    var SelectNum = 0;
    var oldType="";
    var ControlID = "";
    function SearchDataAjax(obj, type, key2) {
       try
       {
        if (event.keyCode == 39 || event.keyCode == 40)
         {
             if (document.getElementById('Select1') != ""&& document.getElementById('Select1')) 
            {
                var dc = document.getElementById("Select1");
                 
                if (dc.selectedIndex == -1) 
                {
                    dc.options[SelectNum].selected = "selected";
                }
                else
                 {
                    dc.options[SelectNum].selected = '';
                    if (dc.options.length == SelectNum+1) 
                    {
                        SelectNum = 0;
                        dc.options[SelectNum].selected = "selected";
                    }
                    else 
                    {
                        SelectNum = SelectNum + 1;
                        dc.options[SelectNum].selected = "selected";
                    }

                }
                obj.value = dc.value;
            }
        }
        else if (event.keyCode == 37 || event.keyCode == 38) {
        if (document.getElementById('Select1') != ""&& document.getElementById('Select1')) 
            {
            var dc = document.getElementById("Select1");
            dc.options[SelectNum].selected = '';
          
            if (0 == SelectNum) 
            {
                SelectNum = dc.options.length-1;
                dc.options[SelectNum].selected = "selected";
            }
            else 
            {

                SelectNum = SelectNum - 1;                
                dc.options[SelectNum].selected = "selected";
            }
            obj.value = dc.value;
           }
        }
        else if (event.keyCode == 13) 
        {                
         SelectNum = 0;
         document.getElementById("more1").innerHTML = '';
         document.getElementById("more1").style.display = 'none';
        }
        else
         {
          
            if (obj.value != '') 
            {
                var status
                if (oldValue == "") 
                {
                    oldValue = obj.value;
                    status = "NEW";
                    
                }
                else 
                {
                    if (obj.value.length > 0) {
                        if (obj.value[0] == oldValue) {
                            status = "OLD";
                        }
                        else {                           
                            status = "NEW";
                            oldValue = obj.value;
                        }
                    }

                }         
                
              
                ControlID = obj.id;
                
               obj.className = "textboxLoading";             
                SelectNum = 0;                 
                var pos = getElementPos(obj.id);             
                document.getElementById("more1").style.top = pos.y + 18;
                document.getElementById("more1").style.left = pos.x;
                var Url = "../Common/SearchDateAjax.aspx?TYPE=" + escape(type) + "&key=" + escape(obj.value) + "&status=" + escape(status) + "&id=" + escape(obj.id) + "&key2=" + escape(document.getElementById(key2).value) + "&ram=" + Math.round(Math.random() * 100);
                createXMLHttpRequest();
                xmlhttp.onreadystatechange = GetSerchDataAjax;
                xmlhttp.open("GET", Url, true);
                xmlhttp.send(null);
            }
            else 
            {              
                document.getElementById("more1").innerHTML = '';
                document.getElementById("more1").style.display = 'none';
            }
        }
        }
        catch(e)
        {
        
        }
    }
    //返回数据
    function GetSerchDataAjax()
    {
        if (xmlhttp.readyState == 4) 
        {
            if (xmlhttp.status == 200) 
            {            
                try
                {
                    document.getElementById(ControlID).className = "textbox";  
                    //alert(xmlhttp.responseText);
                    document.getElementById("more1").innerHTML = xmlhttp.responseText;
                    document.getElementById("more1").style.display = '';
                }
                catch(e)
                {
                }
            }
        }
    }

    function SetValue(obj) 
    {
        document.getElementById(ControlID).value = obj.value;
    }

    function CloseSearch() 
    {

        if (ControlID.length > 0) 
        {
            try
            {
                document.getElementById(ControlID).className = "textbox";
                SetValue(document.getElementById(ControlID))     
                ControlID = "";
            }
            catch(e)
            {
            
            }
      }
        document.getElementById("more1").innerHTML = "";
        document.getElementById("more1").style.display = 'none';
    }

    function LoseFocus() {
       
        setTimeout("CloseSearch()", 600);

    }






    //显示DIV
    function ShowMessageInfoDiv(messageRowID,messageTitle, messageContent) {
        try {
            var mask;
            mask = document.createElement('div');
            mask.id = "divMessage";
            mask.style.width="200px";
            mask.style.height="160px";
            mask.style.position="absolute";
            mask.style.bottom = 0;
            mask.style.right = 0;
            mask.style.overflow = "hidden";
            //mask.style.z-index="100";
            mask.className = 'pop_bg';
            window.scrollTo(1, 1); //在窗口或框架内调整一个文档的滚动方式(Window.Scroll()方法的最佳使用是当你希望用户位于文档中的基础位置时，把它作为文档内的垂直滚动(window.scroll(0,0))的一种手段。)
            if (getTopScrollValue() == 1) {//存在竖滚动条
                var bottomHeight = "-" + document.documentElement.scrollTop;
                mask.style.bottom = parseInt(bottomHeight) + "px";
            }
            if (getLeftScrollValue() == 1) {//存在横滚动条
                var rightHeight = "-" + document.documentElement.scrollLeft;
                mask.style.right = parseInt(rightHeight) + "px";
            }
            document.body.appendChild(mask);
            if (messageContent.toString().length > 100) {
                messageContent = messageContent.substring(0, 100) + "......";
            }
            var messageStr = "<div style='width: 100%; height: 22px;font-size: 12px; overflow: hidden; color: #ffffff;'><span id='message_close' style='float: right; padding: 2px 2px 2px 0; width: 16px;line-height: 16px; color: white; font-size: 14px; font-family:Verdana, Arial;  text-align: center; cursor: pointer; overflow: hidden;' onclick='CloseMessageInfoDiv()'>×</span><div style='padding: 2px 0 2px 5px; width: 150px; line-height: 18px; text-align: left; overflow: hidden;'>" + messageTitle + "</div><div style='clear: both;'></div></div><div style='padding-bottom: 5px; width: 100%;height: auto;'><div id='message_content' style=' padding: 8px 0 10px 8px; font-size: 12px; line-height: 16px; width: 190px; color: #1f336b; text-align: left; overflow: hidden;'><a href ='javascript:HrefUnreadMessage(" + messageRowID + ")' id=asddfs >" + messageContent + "</a></div>";
            document.getElementById("divMessage").innerHTML = messageStr;
        }
        catch (e) {
        }
    }
    
    //链接到未读消息
    function HrefUnreadMessage(messageRowID) {
        if (window.top.frames['main'].location.href.indexOf("default.htm") > 0) {
            location.href = "Administration/InMessage.aspx?from=list&ID=" + messageRowID;
        }
        else {
            location.href = "../Administration/InMessage.aspx?from=list&ID=" + messageRowID;
        }
    }
    
    //关闭层
    function CloseMessageInfoDiv() {
        try {
            var div = document.getElementById("divMessage");
            if (div != null) {
                div.style.display = "none"; //隐藏div
                div.parentNode.removeChild(div); //删除div
            }

        }
        catch (e) {
        }
    }
    try {
        jQuery(window).scroll(
	function() {
	    var bottomHeight = "-" + document.documentElement.scrollTop;
	    var rightHeight = "-" + document.documentElement.scrollLeft;
	    var div = document.getElementById("divMessage");
	    if (div != null) {
	        div.style.bottom = parseInt(bottomHeight) + "px";
	        div.style.right = parseInt(rightHeight) + "px";
	    }
	}
);
    }
    catch (e) {

    }
    //是否存在竖滚动条
    function getTopScrollValue() {
        return Math.max(document.body.scrollTop, document.documentElement.scrollTop);
    }
    //是否存在横滚动条
    function getLeftScrollValue() {
        return Math.max(document.body.scrollLeft, document.documentElement.scrollLeft);
    }
    
   
  
   